<template>
	<view class="content">
		<trunover @eventClick="itemClick" title='消费记录' :turnovers="turnovers" :accountColor='activeColor' v-if="turnovers.length>0"></trunover>
		<empty v-else emptyText='还没有消费记录'></empty>
	</view>
</template>

<script>
	import trunover from "@/components/trunover/trunover.vue"
	import empty from '@/components/empty.vue'

	export default {
		components: {
			trunover,
			empty
		},
		data() {
			return {
				turnovers: [],
				activeColor: '#ab89fe'
			};
		},
		onLoad() {
			this.loadList()
		},
		methods: {
			loadList() {
				let that = this
				that.$Request.request('/api/Usercentinfo/consumeRecord', 'GET', {}).then(res => {
					if (res.status == 1) {
						let list = res.data
						list.forEach(item => {

							let turn = {
								reson: item.describe,
								createtime: item.createTime,
								money: item.money,
								remark: item.remark
							}
							that.turnovers.push(turn)
						})
					}

				}).catch(err => {
					console.log(err)
				})
			},
			itemClick(param) {
				this.$api.msg(param.remark)
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding-top: 20rpx;
	}
</style>
